<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@page import="com.news.bean.NewsType;"%>
<%@page import="com.news.util.Pager"%>
<%@page import="com.news.bean.NewsType"%>
<%@page import="com.news.bean.News"%>
<%@page import="com.news.dao.impl.*" %>
<%
            String path = request.getContextPath();
            String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <base href="<%=basePath%>">

        <title>My JSP 'newsAdd.jsp' starting page</title>

        <meta http-equiv="pragma" content="no-cache">
        <meta http-equiv="cache-control" content="no-cache">
        <meta http-equiv="expires" content="0">
        <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
        <meta http-equiv="description" content="This is my page">
        <script type="text/javascript" src="ckeditor/ckeditor.js"></script>
        <script type="text/javascript" src="My97DatePicker/WdatePicker.js"></script>

    </head>

    <body>
        <script type="text/javascript">
            function check(){
                try{
                    var sort =document.dateform.sort.value;

                    if(sort==0){
                        alert('请选择新闻类型！');
                        return (false);
                    }
                    
                    
                }catch(err){
                    alert(err.message);
                }

                try{
                    var sort =document.dateform.dates.value;

                    if(sort==0){
                        alert('时间不能为空！');
                        return (false);
                    }


                }catch(err){
                    alert(err.message);
                }
            }

        </script>

    <LINK href="images/admin_css.css" type=text/css rel=stylesheet>
          <form name="dateform" method="post" action="news?cmd=add" onSubmit="return check();" enctype="multipart/form-data">
        <table width="98%"  border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#F2F9FD">
            <tr bgcolor="#D2E8F6">
                <td height="25" colspan="2">&nbsp;&nbsp;<strong>添加信息</strong></td>
            </tr>
            <tr bgcolor="#FFFFFF">
                <td width="68" height="25" align="right" bgcolor="#FFFFFF" class="gray">标题：</td>
                <td width="918" bgcolor="#FFFFFF"><input name="title" type="text" class="input" id="title" size="60" dataType="Require"  msg="请填写信息标题！">
                    <font color="red">*</font><font color="gray">信息标题</font></td>
            </tr>
            <tr bgcolor="#FFFFFF" class="tableborder">
                <td height="25" align="right" class="gray">图片：</td>
                <td bgcolor="#FFFFFF" class="gray"><input type="file" name="pic" id="pic" maxlength="60" size="37" value="">
                    <font color="red" size="3">
                        上传图片</font><font color="black" size="2">(图片大小必须小于200K，否则不能上传)</font></td>
            </tr>
            <tr bgcolor="#FFFFFF" class="tableborder" id="pic" style="display:none ">
                <td height="25" align="right" class="gray">上传：</td>
                <td bgcolor="#FFFFFF"><iframe frameborder=0 name=upload_frames width=400 height=25 scrolling=no src='../up/admin_Upload_Pic.asp'></iframe>
                    &nbsp;</td>
            </tr>
            <tr bgcolor="#FFFFFF">
                <td width="68" height="25" align="right" bgcolor="#FFFFFF" class="gray">栏目：</td>
                <td bgcolor="#FFFFFF"><select name="sort" id="sort" dataType="Require"  msg="请选择相关栏目！">
                        <option value="0" selected>请选择相关栏目</option>

                        <option value="" style="BACKGROUND-COLOR: #f0f0f0">新闻中心</option>
                        <%
            List<NewsType> newsTypes = new NewsTypeDaoImpl().list();
            if (newsTypes != null) {
                for (NewsType newstype : newsTypes) {
                        %>
                        <option value="<%=newstype.getId()%>"><font color="#f0f0f0"> ├</font><%=newstype.getName()%></option>
                        <%
                }
            }
                        %>


                    </select>
                    <font color="red">*</font> <font color="gray">信息所属的相关栏目</font> </td>
            </tr>
            <tr bgcolor="#FFFFFF">
                <td width="68" height="25" align="right" bgcolor="#FFFFFF" class="gray">作者：</td>
                <td bgcolor="#FFFFFF"><input name="writer" type="text" class="input" id="writer" value="admin"  dataType="Require"  msg="作者不能为空！">
                    <font color="red">*</font> <FONT color=gray>发布信息单位或者摘自单位名称！</FONT></td>
            </tr>
            <tr bgcolor="#FFFFFF">
                <td width="68" height="25" align="right" bgcolor="#FFFFFF" class="gray">时间：</td>
                <td valign="middle" bgcolor="#FFFFFF" class="gray"><table width="300" border="0" cellpadding="0" cellspacing="0">
                        <tr valign="middle">
                            <td width="76">
                                <input  name="dates" type="text" class="form2" readonly="readonly" onclick="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd'});" size="10" />
                            </td>
                            <td width="208"></td>
                        </tr>
                    </table></td>
            </tr>
            <tr bgcolor="#FFFFFF">
                <td width="68" height="25" align="right" bgcolor="#FFFFFF" class="gray">显示：</td>
                <td bgcolor="#FFFFFF"><input name="shows" type="checkbox" id="shows" value="1" checked">
                                             <font color="gray">(打&quot;√&quot;则会在网页上面显示，否则只在后台显示)</font></td>
            </tr>
            <tr bgcolor="#FFFFFF">
                <td height="25" align="right" bgcolor="#FFFFFF" class="gray">点击：</td>
                <td valign="middle" bgcolor="#FFFFFF"><input name="hits" type="text" class="input" id="hits"  size="10" dataType="Number" value="1" msg="点击次数不能为空，必须为数字！">
                    <font color="red">*</font><FONT color=gray>点击次数，默认为1，如需手工填写，填写内容必须为数字！</FONT></td>
            </tr>
            <tr bgcolor="#FFFFFF">
                <td width="68" height="35" align="right" bgcolor="#FFFFFF" class="gray">信息：</td>
                <td valign="top" bgcolor="#FFFFFF"><textarea name="message" id="message"></textarea>
                    <script type="text/javascript">
                        CKEDITOR.replace( 'message',
                        {
                            skin: 'v2',
                            toolbar : [ [ 'Bold', 'Italic' ],['NumberedList', 'BulletedList'], [ 'Link','Unlink' ],['Preview'] ]
                        });
                    </script></td>

            </tr>
            <tr bgcolor="#FFFFFF">
                <td width="68" height="35" bgcolor="#FFFFFF" class="gray">&nbsp;</td>
                <td bgcolor="#FFFFFF"><input name="Submit" type="submit" class="button" value=" 提 交 ">
                    <input name="Submit" type="reset" class="button" value=" 重 置 ">
                    <input name="Submit" type="button" class="button" onclick="history.go(-1);" value=" 返 回 "></td>
            </tr>
        </table>
    </form>
</body>
</html>
